import "package:flutter/material.dart";
import "./widget/shop/ScrollRowTab.dart"; //水平滚动列表菜单
import "./widget/shop/HeaderBar.dart"; //顶部状态栏+导航栏
import "./widget/shop/SearchBar.dart"; //搜索栏
import "./widget/shop/RecommendPageView.dart"; //最近热门推荐
import "./widget/shop/HotSwiper.dart"; //热门推荐轮播
import "./widget/shop/NewLuckyBox.dart"; // 最新欧气盲盒推荐
import "./widget/shop/RecommendMenuNew.dart"; // 推荐今日、最新、排行、福利菜单
import "./widget/shop/WaterfallList.dart"; //瀑布流商品列表

class Shop extends StatefulWidget {
  const Shop({super.key});
  @override
  State<StatefulWidget> createState() {
    return _ShopState();
  }
}

class _ShopState extends State<Shop> {
  late ScrollController scrollController = ScrollController();

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    scrollController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        HeaderBarWidget(controller: scrollController),
        Expanded(
          child: MediaQuery.removePadding(
              context: context,
              removeTop: true,
              child: CustomScrollView(
                controller: scrollController,
                slivers: [
                  SliverToBoxAdapter(
                    child: Column(
                      children: [
                        const SearchBarWidget(),
                        ScrollRowTabWidget(),
                        const RecommendPageViewWidget(),
                        Container(
                          padding: const EdgeInsets.only(
                              left: 8, right: 8, top: 4, bottom: 3),
                          child: const Row(
                            children: [
                              Expanded(child: HotSwiperWidget()),
                              Expanded(child: NewLuckyBoxWidget()),
                            ],
                          ),
                        ),
                        Container(
                          padding:
                              const EdgeInsets.only(left: 8, right: 8, top: 5),
                          child: RecommendMenuNewWidget(),
                        ),
                      ],
                    ),
                  ),
                  SliverPadding(
                    padding: const EdgeInsets.only(left: 8, right: 8, top: 6),
                    sliver: WaterfallListWidget(),
                  ),
                  const SliverToBoxAdapter(child: SizedBox(height: 100))
                ],
              )),
        ),
      ],
    );
  }
}
